import request from '@/utils/request'

// 查询业务-素材信息列表
export function listImgInfo(query) {
  return request({
    url: '/business/imgInfo/list',
    method: 'get',
    params: query
  })
}

// 查询业务-素材信息列表
export function searchImage(query) {
  return request({
    url: '/business/imgInfo/searchImage',
    method: 'get',
    params: query
  })
}

// 查询业务-素材信息详细
export function getImgInfo(id) {
  return request({
    url: '/business/imgInfo/' + id,
    method: 'get'
  })
}

// 新增业务-素材信息
export function addImgInfo(data) {
  return request({
    url: '/business/imgInfo',
    method: 'post',
    data: data
  })
}

// 修改业务-素材信息
export function updateImgInfo(data) {
  return request({
    url: '/business/imgInfo',
    method: 'put',
    data: data
  })
}

// 删除业务-素材信息
export function delImgInfo(id) {
  return request({
    url: '/business/imgInfo/' + id,
    method: 'delete'
  })
}

// 导出文件
export function exportExcel(query){
  return request({
    url: '/business/imgInfo/export',
    method: 'get',
    params: query
  })
}

// 状态变更
export function updateChangeStatus(ids, status){
  return request({
    url: '/business/imgInfo/changeStatus',
    method: 'put',
    params: {
      ids: ids,
      status: status
    }
  })
}

// 根据素材编码查询素材信息
export function getImgInfoByIds(ids) {
  return request({
    url: '/business/imgInfo/getImgInfoByIds/' + ids,
    method: 'get'
  })
}

// 判断文件是否已上传
export async function isExistFile(imgHash){
  return request({
    url: '/business/imgInfo/isExistFile/' + imgHash,
    method: 'get',
  })
}

// 查询特征码成功失败个数
export function getVectorsCount(){
  return request({
    url: '/business/imgInfo/getVectorsCount',
    method: 'get',
  })
}

// 重新生成图片特征码
export function generateVectors(){
  return request({
    url: '/business/imgInfo/generateVectors',
    method: 'get',
  })
}
